
<%@page import="com.spmanage.util.BillingUtil"%><%@page import="com.spmanage.util.DbOperation"%>
<%@page import="com.spmanage.util.SqlUtil"%><%@page import="com.spmanage.util.WebAction"%>
<%@page import="com.spmanage.util.StringUtil"%><%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%><%
	WebAction webAction = new WebAction(request,response);
    
    System.out.println(request.getQueryString());
    
    String userPhone = webAction.getParameterString("userPhone");
    String channel = webAction.getParameterString("channel");
    String linkId = webAction.getParameterString("linkId");
    String fee = webAction.getParameterString("fee");
    String status = webAction.getParameterString("status");
    
    
    String spNo = SqlUtil.getStringResult("select dest from recv where linkid = '"+linkId+"'",DbOperation.DB_STAT);
    String content = SqlUtil.getStringResult("select body from recv where linkid = '"+linkId+"'",DbOperation.DB_STAT);
    String msgId = webAction.getParameterString("msgId");
    //String spNo = webAction.getParameterString("spNo");
    
    
    String srvCode = webAction.getParameterString("srvCode");
    String feeType = webAction.getParameterString("feeType");
    
    
    String date = webAction.getParameterString("date");
    
    
    System.out.println("*********");
    int provinceId = BillingUtil.getProvinceId(userPhone);
    System.out.println(provinceId);
    StringBuilder sb = new StringBuilder();
    sb.append("'");
    sb.append(provinceId);
    sb.append("',");
    sb.append("1");//msgmode
    sb.append(",");
    sb.append("15");//fmt
    sb.append(",");
    sb.append("0");//futype
    sb.append(",");
    sb.append("2");//ftype
    sb.append(",");
    sb.append(fee);//feecode  
    sb.append(",");
    sb.append("'");
    sb.append("XXLYYY");//stype
    sb.append("',");
    sb.append("1");//num
    sb.append(",");
    sb.append("'");
    sb.append(userPhone);
    sb.append("',");
    sb.append("'");
    sb.append(spNo);
    sb.append("',");
    sb.append("'");
    sb.append(userPhone);
    sb.append("',");
    sb.append("getDate()");  //tm
    sb.append(",");
    sb.append("'");
    sb.append("mid");  //mid
    sb.append("',");
    sb.append("'");
    sb.append("msgid");  //msgid
    sb.append("',");
    sb.append("0");//result  DELIVRD
    sb.append(",");
    sb.append("'");
    sb.append(status);//DELIVRD
    sb.append("',");
    sb.append("'");
    sb.append("infoid");//infoid
    sb.append("',");
    sb.append("'");
    sb.append(linkId);//linkid
    sb.append("','"+content+"'");
    sb.append(",");
    sb.append(provinceId);
        
    SqlUtil.executeUpdate("insert into "+BillingUtil.getSendDay()+"(areaid,msgMode,fmt,futype,ftype,feecode,stype,num,org,dest,fee,tm,mid,msgid,result,stat,infoid,linkid,body,province) values("+sb.toString()+")",DbOperation.DB_STAT);
	
    response.getWriter().write("OK");
    //String msg = StringUtil.decodeStringByUTF8(webAction.getParameterString("msg"));
	
	//System.out.println("msg:"+msg);
	
	
	
%>
